<?php require_once('../mysqlUtil.php');

require_once('../islogin.php');

class User{
    public $id;
    public $username;
    public $time;
}

//查询数据库
$sql = "select id,username,time from t_user";
//mysqli_query()
$result=$conn->query($sql);


$data = array();


if ($result->num_rows > 0) {
    // 准备返回的json数据
    while($row=$result->fetch_assoc()){
        $user=new User();
        $user->id=$row['id'];
        $user->username=$row['username'];
        $user->time=$row['time'];
        $data[]=$user;
    }
    echo json_encode(array('state'=>200,'content'=>$data));   
} else {
    $data['state']=false;
    $data['msg']='验证码错误';  
    echo json_encode($data);   
}

 
$conn->close();
?>